<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>homepage</title>
        <style>@import url("../resources/css/homepageCSS1.css")</style>

    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit styleClass="topLayout" position="north" size="100" resizable="true">

                <img id="titleImg" src="../resources/images/titolo90.png" alt="METEOCAL"/>
                <div id="userBlock">
                    <h:form>
                        <p:outputLabel>
                            #{userBean.name}&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:commandLink style="color: blue;" action="#{loginBean.logout()}" value="Logout"/>
                    </h:form>
                </div>
                <div id="searchBar">
                    <h:form>
                        <p:inputText styleClass="inputTextStyleNoBorder" id="search" value="#{userBean.searchText}" required="true"/>
                        <p:commandButton value="" style="border: 1px solid #000000; width: 32px; height: 32px; background: #000000 url(../resources/images/search_icon3.png) no-repeat top right" action = "#{userBean.search()}">
                            <f:param name="text" value="#{userBean.searchText}">
                            </f:param>
                        </p:commandButton>
                    </h:form>
                </div>
            </p:layoutUnit>

            <p:layoutUnit styleClass="rightLayout" position="east" size="200" header="Menu" resizable="true" closable="false" collapsible="true" effect="drop">
                <div id="menu">
                    <br/>
                    <h:form>
                        <p:commandButton id="profileBtn" styleClass="menuBtn" value="Profile" action="profile?faces-redirect=true"/>
                        <br/>
                        <br/>
                        <p:commandButton id="newEventBtn" styleClass="menuBtn" value="New Event" action="newEventPage?faces-redirect=true"/> 
                        <br/>
                        <br/>
                        <p:commandButton id="myEventsBtn" styleClass="menuBtn" value="Upcoming Events" action="#{userBean.loadCalendar()}"/>
                        <br/>
                        <br/>
                        <p:commandButton style="width: 180px; height: 40px; background: #d3dfe5 url(../resources/images/#{userBean.checkPendingMessages()}_not_read.png) no-repeat top right" id="myMessagesBtn"  value="Notifications" action="myMessages?faces-redirect=true"/> 
                    </h:form>
                </div>
            </p:layoutUnit>
            <p:layoutUnit styleClass="centralBlock" position="center">
                <div id="schedPanel" align="center">
                    <h:form>
                        <p:schedule style=" opacity: 0.92" id="schedule" value="#{calendarBean.eventModel}" widgetVar="myschedule" timeZone="GMT+1" draggable="false" resizable="false">
                            <p:ajax event="eventSelect" update="eventDetails" listener="#{calendarBean.onEventSelect}" oncomplete="PF('eventDialog').show();" />
                        </p:schedule>

                        <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
                            <h:panelGrid id="eventDetails" columns="2">
                                <h:outputLabel for="title" value="Title:" />
                                <h:outputLabel id="title" value="#{calendarBean.selectedEvent.title}"/>

                                <h:outputLabel for="from" value="From:" />
                                <h:outputLabel id="from" value="#{calendarBean.selectedEvent.startDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy &nbsp;-&nbsp; HH:mm" timeZone="GMT+1"/>
                                </h:outputLabel>

                                <h:outputLabel for="to" value="To:" />
                                <h:outputLabel id="to" value="#{calendarBean.selectedEvent.endDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy &nbsp;-&nbsp; HH:mm" timeZone="GMT+1"/>
                                </h:outputLabel>
                            </h:panelGrid>
                            <p:commandButton value="Details" action="#{calendarBean.redirectToEvent}"/>
                        </p:dialog>
                    </h:form>
                </div>
            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

